﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web;
using FAQFrameworks;
using DTOFrameworks;
using FooFun.Faq.Models;

namespace FooFun.Faq.Web.Modules
{
    // todo:暂时不使用
    public class LastVisitModule : IHttpModule
    {
        #region IHttpModule 成员

        public void Dispose()
        {
            return;
        }

        public void Init(HttpApplication application)
        {
            application.EndRequest += new EventHandler(application_EndRequest);
        }

        void application_EndRequest(object sender, EventArgs e)
        {
            HttpApplication application = sender as HttpApplication;
            FAQContext context = FAQContext.Current;

            if (context.User.AccountId != Guid.Empty
                && application.Request.RawUrl.IndexOf("Login.ashx") == -1)
            {
                UserManager userManager = new UserManager();
                userManager.UpdateLastVisiteTime(context.User.AccountId);
            }
        }

        #endregion
    }
}
